package unit04.day04;
/**
 * 守护线程
 * 当一个进程中的所有前台线程都结束时，进程就要结束,若还有后台线程运行，那么后台线程会被强制结束
 * @author Administrator
 *
 */
public class ThreadDemo7 {

	public static void main(String[] args) {
		Thread Rose = new Thread() {
			public void run() {
				for(int i = 0 ; i < 10; i++) {
					System.out.println("let me go!");
					try {
						Thread.sleep(1000);
					} catch (InterruptedException e) {
						// TODO 自动生成的 catch 块
						e.printStackTrace();
					}
				}
				System.out.println("aaaaaaaaaaaa");
				System.out.println("boom~~");
			}
		};
		Thread Jack = new Thread() {
			public void run () {
				while(true) {
					System.out.println("you jump i jump");
					try {
						Thread.sleep(1000);
					} catch (InterruptedException e) {
						// TODO 自动生成的 catch 块
						e.printStackTrace();
					}
				}
			}
		};
		//设置后台线程
		Jack.setDaemon(true);
		Rose.start();
		Jack.start();
	}

}
